<?php
namespace app\admin\model\yihu;

use think\Model;

class ElderlyModel extends Model
{
    protected $connection = 'database.mzshow';
    protected $table = 'yihu_elderly'; // 表名

    //拼接地址(到街道)
    public static function getHomeaddressForStreet($home_region_id)
    {
        $homeaddress = [];
        $home_region_id_arr = json_decode($home_region_id,true);
        if(!empty($home_region_id)){
            $home_region_id_str = implode(',',$home_region_id_arr);
            $region = RegionModel::find()->where('id in ('.$home_region_id_str.')')->field('title')->select();
            if(isset($region)&&$region){
                foreach ($region as $v){
                    array_push($homeaddress,$v['title']);
                }
            }
        }
        return implode('',$homeaddress);
    }

}
